#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time: 2022/9/16 15:32
# @Author: 徐洪英
# @Email: xx@gmail.com
# @File：rie_alter_page.py
from selenium.webdriver.common.by import By
from config.config import HOST
from time import sleep
from pages.base_page import BasePage
class CrmAlertRiePage(BasePage):
    """类属性"""
    url="http://{}/crm/index.php?m=finance&a=edit&t=receivables&id=127".format(HOST)
    alert_success_locator = (By.XPATH, "/html/body/div[5]/div[2]")  # 断言修改成功
    alert_locator = (By.LINK_TEXT, "修改")  # 修改
    ys_xg_name_locator = (By.XPATH, "/html/body/div[5]/div[2]/div/form/table/tbody/tr[2]/td[2]/input")  # 修改收款名
    sk_xg_submit_locator = (By.NAME, "submit")  # 保存
    def alert_rie(self):
        """点击修改按钮"""
        self.driver.find_element(*self.alert_locator).click()
    def alert_rie_name(self,alert_name):
        """修改应收款名字"""
        self.driver.find_element(*self.ys_xg_name_locator).send_keys(alert_name)
    def alert_click_submit(self):
        """点击保存按钮"""
        self.driver.find_element(*self.sk_xg_submit_locator).click()
    def alert_rie_list(self,alert_name):
        self.alert_rie() #点击修改按钮
        self.alert_rie_name(alert_name) #修改应收款名字
        self.alert_click_submit() #点击保存按钮
    def actual_alert_stutas(self):
        """断言修改应收款"""
        actual = self.driver.find_element(*self.alert_success_locator).text
        return actual